Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CS] Avoid CA2200 warning when rethrowing #9999

Merged

Conversation

kLabz
Copy link
Contributor

@kLabz kLabz commented Dec 18, 2020

Code like that:

try {
	throw something;
} catch (eof:haxe.io.Eof) {}

Generates:

try {
	// ...
}
catch (global::System.Exception _g){
	if (( ((object) (global::haxe.Exception.caught(_g).unwrap()) ) is global::haxe.io.Eof )) {
	}
	else {
		throw _g;
	}
	
}

Which results in a runtime warning from C#:

warning CA2200: Re-throwing caught exception changes stack information

According to https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2200, throw _g here should be just throw.

Note: this warning is currently generated with haxe std (haxe.io.Input) too

@RealyUniqueName RealyUniqueName merged commit f59be49 into HaxeFoundation:development Dec 18, 2020
@skial skial mentioned this pull request Dec 23, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants